//
//  IDCardCertificationController.m
//  OnionHome
//
//  Created by fengjie on 2019/10/2.
//  Copyright © 2019 FengJie. All rights reserved.
//

#import "IDCardCertificationController.h"
#import "IDCardCertificationTwoController.h"
#import "IDCardCertificationCell.h"

@interface IDCardCertificationController ()

/**listViewTool*/
@property (nonatomic,strong)UITableViewTool*listViewTool;
/**<#属性#>*/
@property (nonatomic,strong)NSMutableArray*dataArray;
@end

@implementation IDCardCertificationController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"身份认证";
    UIButton * bottomBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [bottomBtn setBackgroundImage:IMAGE_NAMED(@"guanzhu_bg") forState:UIControlStateNormal];
    [bottomBtn setTitle:@"下一步" forState:UIControlStateNormal];
    kWeakSelf(weakSelf);
    [bottomBtn addActionHandler:^{
        
        [weakSelf.navigationController pushViewController:[IDCardCertificationTwoController new] animated:YES];
    }];
    
    
    [self.view addSubview:bottomBtn];
    
    [self.listViewTool.listView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(0);
        make.bottom.mas_equalTo(-50);
    }];
    
    [bottomBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.mas_equalTo(0);
        make.height.mas_equalTo(50);
    }];
}

-(UITableViewTool*)listViewTool{
    if(!_listViewTool){

        _listViewTool=[[UITableViewTool alloc] initWithFrame:CGRectZero style:UITableViewStylePlain registerCellClassName:NSStringFromClass([IDCardCertificationCell class]) identifier:NSStringFromClass([IDCardCertificationCell class]) dataArray:self.dataArray delegate:self dataSourceBlock:^(id  _Nonnull TempCell, NSIndexPath * _Nonnull indexPath, id  _Nonnull TempData) {
            IDCardCertificationCell * cell = (IDCardCertificationCell *)TempCell;
            cell.dic = (NSDictionary *)TempData;
            
        } selectCell:^(id  _Nonnull TempCell, NSIndexPath * _Nonnull indexPath, id  _Nonnull TempData) {
            
        }];
        _listViewTool.listView.backgroundColor = UIColorFromRGB(0xF5F7F5);
        _listViewTool.listView.tableHeaderView = [self createHeaderView];
    }
    return _listViewTool;
}
-(NSMutableArray *)dataArray{
    if (!_dataArray) {
        NSDictionary * oneDic = @{@"leftName":@"有清晰头像",@"rightName":@(true)};
        NSDictionary * twoDic = @{@"leftName":@"合法用户名",@"rightName":@(false)};
        NSDictionary * thereDic = @{@"leftName":@"发布过葱花内容",@"rightName":@(true)};

        _dataArray =[NSMutableArray array];
        [_dataArray addObject:oneDic];
        [_dataArray addObject:twoDic];
        [_dataArray addObject:thereDic];

    }
    return _dataArray;
}
-(UIView *)createHeaderView{
    UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 60)];
    view.backgroundColor = KWhiteColor;
    UILabel * label = UILabel.new;
    label.textColor = KBlackColor;
    label.font = BOLDSYSTEMFONT(18);
    label.textAlignment = NSTextAlignmentCenter;
    label.text = @"申请条件";
    
    [view addSubview:label];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(0);
    }];
    
    return view;
}
@end
